package rmold

import (
	"huling/app/wxapp"

	"github.com/gin-gonic/gin"
)

/**微信小程序*/
func ApiWxapp(R *gin.Engine) {
	//微信小程序根路由
	wxappPath := R.Group("/wxapp")
	{

		//登录
		authPath := wxappPath.Group("/auth")
		{
			authPath.GET("/getOpenId", wxapp.GetOpenId)
			authPath.GET("/getPhone", wxapp.GetPhone)
			authPath.GET("/refreshtoken", wxapp.Refreshtoken)
			authPath.GET("/getWxacode", wxapp.GetWxacode)
			authPath.GET("/getFirstwxaCode", wxapp.GetFirstwxaCode)
			authPath.POST("/saveUser", wxapp.SaveUser)
		}
		//用户信息
		userPath := wxappPath.Group("/user")
		{
			userPath.GET("/getUserProduct", wxapp.GetUserProduct)
		}
		//编辑名片
		cardPath := wxappPath.Group("/card")
		{
			cardPath.GET("/getCard", wxapp.GetCard)
			cardPath.POST("/saveCard", wxapp.SaveCard)
			cardPath.POST("/addVisitRecode", wxapp.AddVisitRecode)
			cardPath.GET("/folderList", wxapp.FolderList)
			cardPath.GET("/visitList", wxapp.VisitList)
			cardPath.GET("/getAgreement", wxapp.GetAgreement)
		}
		//分组
		groupPath := wxappPath.Group("/group")
		{
			groupPath.POST("/saveGroup", wxapp.SaveGroup)
			groupPath.GET("/getGroup", wxapp.GetGroup)
		}
		//卡片操作
		folderPath := wxappPath.Group("/folder")
		{
			folderPath.DELETE("/delCard", wxapp.DelCard)
			folderPath.POST("/addCard", wxapp.AddCard)
			folderPath.POST("/addToGroup", wxapp.AddToGroup)
			folderPath.GET("/delCardFolder", wxapp.DelCardFolder)
			folderPath.GET("/getListByGroup", wxapp.GetListByGroup)
		}
		//产品
		productPath := wxappPath.Group("/product")
		{
			productPath.POST("/saveSelectProduct", wxapp.SaveSelectProduct)
			productPath.POST("/saveProduct", wxapp.SaveProduct)
			productPath.GET("/getProductList", wxapp.GetProductList)
			productPath.GET("/delProduct", wxapp.DelProduct)
			productPath.GET("/getProduct", wxapp.GetProduct)
		}
	}

}
